﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;

namespace Palsta.Core
{
    public class XslValueOf : XslElement
    {
        /*
         * Constructors
         */ 
        public XslValueOf(XmlNode xslNode)
            : base(xslNode)
        {
            _jsFunctionName = _functionPrefix + "value_of";
        }

        /*
         * Overrides
         */
        public override String GetFunctionDeclareScript()
        {
            String select = _xmlNode.Attributes["select"].Value;
            String result = "function " + _jsFunctionName + "_" + _index.ToString() + "() { \r\n";
            result += "return $('#" + select + "').val();\r\n";
            result += "}\r\n";
            return result;
        }
    }
}
